#pragma once
#ifndef _BASESHAPE_
#define _BASESHAPE_

#define Radius lengthSide / (2.0 * sin(2 * PI / 10))
const double PI = 4 * atan(1.0);
extern enum BASESHAPE__T
{
	//select hinh
	SELECT_T,
	//BOND
	THREEBOND_T,
	TRIBOND_T,
	WEDGEBOND_T, // tam giac mau den
	WHITEHASHBOND_T,
	UNDEFINEBOND_T,
	BOLDBOND_T,
	DOUBLEBOLDBOND_T,
	DOUBLEARROW_T,// mui ten 2 chieu
	CIRCLEBENZENE_T,
	CYCLOPROPANE_T,
	CYCLOPUTANE_T,

	ARROW_T,
    BENZENBOND_T,
    CIRCLE_T,
	ECLIPSE_T, //MOI THEM
    CLYCLEBENZENBOND_T,
	CYCLOPENTANE_T,// N  hinh nam canh ho cyclo...
    CURVER_T,
    CYCLOHEXANEBOND_T,
    DOUBLEBOND_T,
    HASHEDWEDGE_T,
	HASHBOND_T,
	LINE_T,
	MECHANISTICARROW_T,// mui ten cong
	//OBITAN
	OBITALCIRCLE_T,
	OBITALBOLD_T,
	OBITALESCLIPSE_T,
	OBITALESCLIPSEBOLD_T, 
	OBITALPIE_T,
	OBITALPIEBOLD_T, 
	OBITALDOUBLEPIE_T,
	OBITALDOUBLEPIEBOLD_T,
	OBITALFLOWER_T ,
	OBITALFLOWERBOLD_T,
	OBITALSMFLOWER_T ,
	OBITALSMFLOWERBOLD_T,
	OBITALSMFLOWERBOLD1_T,
	ONEBOND_T,
	RECTANEGLE_T,
	ROUNDEDRECTANGLE_T,
	SQUARE_T, //MOI THEM
	SYMBOL_T,

	//SYMBOL
	PLUSCIRCLE_T,
	PLUSPOINT_T,
	PLUS_T,
	SUBCIRCLE_T,
	SUBPOINT_T,
	SUB_T,
	ONEPOINT_T,
	DOUBLEPOINT_T,

	TEXT_T,
	TRACKER_BITMAP
};

class BaseShape : public CObject
{
	DECLARE_SERIAL (BaseShape)
public:
	CPoint m_pBegin, m_pEnd;
	CPoint m_pMax, m_pMin;
	INT m_nAngle;
	CPoint *m_pCoordinates; //luu toa do cua cac dinh trong hinh ve;
	CBrush m_brushColor; 
    COLORREF m_cPenColor;
	COLORREF m_clrBack;
	INT m_nPenWidth;
	INT m_nPenStyle;
	BASESHAPE__T m_nShapeType;
	BOOL m_bSelected;
	INT m_nViTri;
	INT m_nCanh;
	//ctext
	CString m_szText;
	CFont m_ftDraw;
	COLORREF m_color;
	LOGFONT lf;
	CSize sizeNor, sizeSup, sizeSub;
	INT m_nRotate;
public:
	BaseShape(void);
	BaseShape(CPoint, CPoint, COLORREF);
	BaseShape (CPoint m_pBegin, CPoint m_pEnd, COLORREF m_clrBack, COLORREF m_cPenColor, BASESHAPE__T m_nShapeType, CString m_szText, COLORREF m_color);
	~BaseShape(void);
public:
	virtual BOOL Draw(CDC *cDC);
	virtual void Serialize ( CArchive &ar);
};

inline double RadiansToDegrees(double radians) 
{ 
	return ( 360 * radians ) / ( 2 * PI ); 
}
inline double DegreesToRadians(double degrees) 
{
	return ( 2 * PI * degrees ) / 360; 
}

CPoint PointCenter(CPoint X1, CPoint Y1, CPoint X2, CPoint Y2);
void LineEquation(INT &A, INT &B, INT &C, CPoint X, CPoint Y);
#endif // !_BASESHAPE_